local guangdmj = fk.CreateSkill {
    name = "guangdmj",
    anim_type = "offensive",
}

Fk:loadTranslationTable{
  ["guangdmj"] = "光盾猛击",
  ["$guangdmj1"] = "来过两招。",
  ["$guangdmj2"] = "抱歉，士兵。",
  ["$guangdmj3"] = "敌人来袭。",
  ["$guangdmj4"] = "（受击音效1）",
  ["$guangdmj5"] = "（受击音效2）",
  ["$guangdmj6"] = "退下！",
  [":guangdmj"] = "出牌阶段，若你装备着<a href=':progoldsheild'>【振金盾牌】</a>，你可弃置任意张手牌并选择至多等量名其他角色，你对这些角色分别造成1点伤害并依次将<a href=':progoldsheild'>【振金盾牌】</a>置入他们的装备区。",
  ["#guangdmj"] = "光盾猛击：你可以弃置任意张手牌等量至多名角色分别造成1点伤害并依次将【振金盾牌】置入他们的装备区",
}

guangdmj:addEffect("active", {
    prompt = "#guangdmj",
    min_card_num = 1,
    min_target_num = 1,
    can_use = function(self, player)
        -- 检查区域内是否有振金盾牌
        local has_shield = false
        for _, id in ipairs(player:getCardIds{Player.Equip}) do
            local card = Fk:getCardById(id)
            if card.name == "progoldsheild" then
                has_shield = true
            end
        end 
        return has_shield and not player:isKongcheng()
    end,
    card_filter = function(self, player, to_select, selected)
        return not player:prohibitDiscard(to_select) and table.contains(player:getCardIds("h"), to_select)
    end,
    target_filter = function(self, player, to_select, selected, cards)
        return #selected < #cards and to_select ~= player
    end,
    
    on_use = function(self, room, effect)
      local player = effect.from
      room:throwCard(effect.cards, guangdmj.name,player,player)
      local cards = table.filter(player:getCardIds{Player.Hand, Player.Equip, Player.Judge}, function(id)
        return Fk:getCardById(id).name == "progoldsheild"
     end)
      for _, target in ipairs(effect.tos) do
        room:moveCardIntoEquip(target, cards, guangdmj.name, true, player)
        if math.random(1, 2) == 1 then
          player:broadcastSkillInvoke("guangdmj", 4)
        else
          player:broadcastSkillInvoke("guangdmj", 5)
        end 
        room:damage({
            from = player,
            to = target,
            damage = 1,
            damageType = fk.NormalDamage,
            skillName = guangdmj.name,
        })
      end
      
    end,
  })


return guangdmj 
